package com.ask.controller;

import com.ask.mapper.RatingMapper;
import com.ask.result.Result;
import com.ask.service.RecommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private RatingMapper ratingMapper;

    @Autowired
    private RecommendService recommendService;

    @PostMapping
    public String test() {
        return "test";
    }

    @GetMapping("/getAllRating")
    public Result getAllRating() {
        return Result.success(ratingMapper.findAll());
    }

    @GetMapping("/recommendItems")
    public Result recommendItems() {
        return recommendService.recommendItems(1L, 10);
    }

    @GetMapping("/getAnything")
    public Result getAnything() {
        return Result.success(recommendService.getSimilarItems(1L));
    }

}
